from sklearn.model_selection import train_test_split
from sklearn.datasets import load_iris
import pandas as pd

# 加载iris dataset为DataFrame数据结构,包含标记
data = load_iris(as_frame=True)
iris_dataset = pd.DataFrame(data.frame)
# 数据集划分
train_set, test_set = train_test_split(iris_dataset, train_size=0.7, random_state=1)
print(train_set, test_set,sep='\n')
